package com.example.project.webControlleer;

import com.example.project.dao.CarDAO;
import com.example.project.pojo.Car;
import com.example.project.pojo.User;
import org.springframework.stereotype.Controller;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
@RequestMapping("web")
public class WebCheckCarController {
    @RequestMapping("checkcar")

    public String checkcar(HttpSession session,Model model)
    {
        CarDAO carDAO=new CarDAO();

        User user=(User)session.getAttribute("user");

        int userId= user.getId();

        List<Car> carList=carDAO.findCarByuserID(userId);

        model.addAttribute("carList",carList);

        return "web/checkcar";
    }

}


